(use-package dired
  :bind
  (:map  dired-mode-map
	 ("l" . dired-up-directory))
  :custom
  (dired-auto-revert-buffer t)
  (dired-recursive-deletes 'top)
  (dired-recursive-copies 'always)
  (dired-dwim-target t)
  (wdired-allow-to-change-permissions t)
  :init
  (defun xah-dired-remove-all-metadata (@file-list)
    "Remove all metatata of buffer image file or marked files in dired.
(typically image files)
URL `http://xahlee.info/img/metadata_in_image_files.html'
Requires exiftool shell command.
URL `http://ergoemacs.org/emacs/emacs_dired_convert_images.html'
Version 2016-07-19"
    (interactive
     (list
      (cond
       ((string-equal major-mode "dired-mode") (dired-get-marked-files))
       ((string-equal major-mode "image-mode") (list (buffer-file-name)))
       (t (list (read-from-minibuffer "file name:"))))))
    (if (y-or-n-p "Sure to remove all metadata?")
	(mapc
	 (lambda ($f)
	   (let ($cmdStr)
	     (setq $cmdStr
		   (format "exiftool -all= -overwrite_original '%s'" (file-relative-name $f))) ; relative paths used to get around Windows/Cygwin path remapping problem
	     (shell-command $cmdStr)))
	 @file-list )
      nil
      )))

(use-package dired-x
  ;; :diminish omit-mode
  :custom
  (dired-omit-mode t)
  ;; :custom
  ;; ;; (setq-default dired-omit-files-p t) ; Buffer-local variable
  ;; (dired-omit-files
  ;;  (concat dired-omit-files "\\|^\\..+$\\|~$"))
  )
